#ifndef _KTV_COLOR_H_
#define _KTV_COLOR_H_

#include "SDL/SDL.h"
#include <cmath>
#include <string>


namespace UI
{
class UI_Color
{
public:
	unsigned char red;
	unsigned char green;
	unsigned char blue;
	unsigned char alpha;
	UI_Color(const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a = 0xFF) :
		red(r), green(g), blue(b), alpha(a) { }
	UI_Color(const Uint32* pColorValue, const SDL_PixelFormat* pFormat);
	SDL_Color ToSDLColor() const{
		SDL_Color color;
		color.r = this->red;
		color.g = this->green;
		color.b = this->blue;
		color.unused = this->alpha;
		return color;
	}

	UI_Color(){
		red = 0;
		green = 0;
		blue = 0;
		alpha =0;
	}
	UI_Color(std::string sColor);
	unsigned long int SDLColor(SDL_PixelFormat* pFormat) const
		{ return SDL_MapRGBA(pFormat, red, green, blue, alpha); }
	bool operator==(const UI_Color& c) const
	{
		return (red == c.red && green == c.green && blue == c.blue);
	}
	bool operator!=(const UI_Color& c) const
	{
		return (red != c.red || green != c.green || blue != c.blue);
	}
	UI_Color& operator=(const UI_Color& c);
	UI_Color operator+(const UI_Color& c) const;
	UI_Color operator|(const UI_Color& c) const;
	UI_Color operator&(const UI_Color& c) const;
	UI_Color operator^(const UI_Color& c) const;
	UI_Color MixNormal(const UI_Color& c) const;

};

extern UI_Color DEFAULT_BACKGROUND_COLOR;
extern UI_Color DEFAULT_FOREGROUND_COLOR;
extern UI_Color DEFAULT_LINE_COLOR;
extern UI_Color DEFAULT_DISABLED_LINE_COLOR;
extern UI_Color COLOR_TRANSPARENT;
extern UI_Color COLOR_WHITE;
extern UI_Color COLOR_LIGHTGRAY;
extern UI_Color COLOR_GRAY;
extern UI_Color COLOR_DARKGRAY;
extern UI_Color COLOR_BLACK;
extern UI_Color COLOR_BLUE;
extern UI_Color COLOR_RED;
extern UI_Color COLOR_GREEN;
extern UI_Color COLOR_YELLOW;
extern UI_Color COLOR_CYAN;
extern UI_Color COLOR_MAGENTA;
extern UI_Color COLOR_SPECIAL;

}

#endif // _UI_Color_H_

